package com.qfedu.controller;

import com.qfedu.pojo.Account;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("account")
//     /account/findAccount
public class AccountController {
    @RequestMapping(value = "findAccount",method = RequestMethod.POST)
    public String findAccout(){
        System.out.println("findAccount执行");
        return "success";
    }
    //params代表请求url必须携带指定参数
    //params的指定了参数值，请求必须携带指定的参数，指定的值才不会报错
    @RequestMapping(value = "addAccount",params = {"username=aa"})
    public String addAccount(){
        System.out.println("addAccount执行");
        return "success";
    }
    @RequestMapping(value = "findAccountById")
    public String findAccountById(int id){
        System.out.println("findAccountById");
        System.out.println("id:"+id);
        return "success";
    }
    @RequestMapping(value = "findAccountByIdAndName")
    /*@GetMapping
    @PutMapping
    @DeleteMapping*/
    public String findAccountById(int id,String name){
        System.out.println("findAccountByIdAndName");
        System.out.println("id:"+id);
        System.out.println(name);
        return "success";
    }

//    @RequestMapping(value = "addNewAccount",method = RequestMethod.POST)
    @PostMapping(value = "addNewAccount")
    public String addNewAccount(Account account){
        System.out.println(account);
        System.out.println("addAccount执行");
        return "success";
    }
}
